package uu.game.majiang.core;

import static org.junit.Assert.assertEquals;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.AN_GANG;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.BIAN_ZHANG;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.BU_QIU_REN;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.DAN_DIAO_JIANG;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.DA_SAN_YUAN;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.DA_SI_XI;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.DA_YU_WU;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.DUAN_YAO_JIU;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.GANG_SHANG_KAI_HUA;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.HAI_DI_LAO_YUE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.HUA_LONG;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.HUA_PAI;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.HUN_YAO_JIU;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.HUN_YI_SE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.HU_JUE_ZHANG;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.JIAN_KE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.JIU_LIAN_BAO_DENG;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.KAN_ZHANG;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.LAO_SHAO_FU;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.LIAN_LIU;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.LIAN_QI_DUI;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.LV_YI_SE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.MEN_FENG_KE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.MEN_QIAN_QING;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.MIAO_SHOU_HUI_CHUN;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.MING_GANG;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.PENG_PENG_HU;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.PING_HU;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.QIANG_GANG_HU;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.QING_LONG;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.QING_YAO_JIU;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.QING_YI_SE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.QI_DUI;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.QI_XING_BU_KAO;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.QUAN_BU_KAO;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.QUAN_DA;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.QUAN_DAI_WU;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.QUAN_DAI_YAO;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.QUAN_FENG_KE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.QUAN_QIU_REN;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.QUAN_SHUANG_KE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.QUAN_XIAO;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.QUAN_ZHONG;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.QUE_YI_MEN;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SAN_AN_KE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SAN_FENG_KE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SAN_GANG;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SAN_SE_SAN_BU_GAO;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SAN_SE_SAN_JIE_GAO;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SAN_SE_SAN_TONG_SHUN;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SAN_SE_SHUANG_LONG_HUI;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SAN_TONG_KE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SHI_SAN_YAO;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SHUANG_AN_GANG;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SHUANG_AN_KE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SHUANG_JIAN_KE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SHUANG_MING_GANG;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SHUANG_TONG_KE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SI_AN_KE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SI_GANG;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.SI_GUI_YI;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.TUI_BU_DAO;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.WU_FAN_HU;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.WU_MEN_QI;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.WU_ZI;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.XIAO_SAN_YUAN;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.XIAO_SI_XI;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.XIAO_YU_WU;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.XI_XIANG_FENG;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.YAO_JIU_KE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.YI_BAN_GAO;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.YI_SE_SAN_BU_GAO;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.YI_SE_SAN_JIE_GAO;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.YI_SE_SAN_TONG_SHUN;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.YI_SE_SHUANG_LONG_HUI;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.YI_SE_SI_BU_GAO;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.YI_SE_SI_JIE_GAO;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.YI_SE_SI_TONG_SHUN;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.ZI_MO;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.ZI_YI_SE;
import static uu.game.majiang.core.rule.paixing.gb.GbPaixing.ZU_HE_LONG;

import org.junit.Before;
import org.junit.Test;

import uu.game.majiang.core.rule.paixing.gb.GbPaixing;

/**
 * 国标牌型测试
 * 因为具体牌型也用JUnit的assertEquals来判断的话太麻烦了，所以JUnit只测试是否和牌，而具体和牌后的牌型还需要看控制台
 * 
 * @author uu
 * @version 2011-1-13 下午03:07:53
 * 
 */
public class TEST_GbPaixing {
    
    @Before
    public void beforeMethod() {
        System.out.println("__________________________________________________________________________________\n");
    }
    
    @Test
    public void loadGbPaixing() {
        // 主要为了加载GbPaixing
        System.out.println("国标牌型：" + GbPaixing.values().length + "种");
    }
    
    @Test
    public void DA_SI_XI() {
        display(DA_SI_XI);
        Pai pai = buildPai(
                41, 41, 41, 
                42, 42, 42, 
                43, 43, 43, 
                44, 44, 44, 51, 
                41, 42);
        pai.mo(51);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void DA_SAN_YUAN() {
        display(DA_SAN_YUAN);
        Pai pai = buildPai(
                51, 51, 51,
                52, 52, 52,
                53, 53, 53,
                44, 44, 44, 41,
                44, 44);
        pai.mo(41);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void LV_YI_SE() {
        display(LV_YI_SE);
        Pai pai = buildPai(
                22, 22, 22,
                23, 23, 23,
                24, 24, 24,
                26, 26, 26, 28,
                44, 44);
        pai.mo(28);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void JIU_LIAN_BAO_DENG() {
        display(JIU_LIAN_BAO_DENG);
        Pai pai = buildPai(
                31, 31, 31,
                32, 33, 34,
                35, 36, 37,
                38, 39, 39, 39,
                44, 44);
        pai.mo(39);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void SI_GANG() {
        display(SI_GANG);
        Pai pai = buildPai(
                31, 31, 31,
                32, 32, 32,
                15, 15, 15,
                29, 29, 21, 39,
                44, 44);
        pai.mo(31);
        pai.angang(pai.canAngang()[0]);
        pai.mo(41);
        pai.chu(41);
        pai.minggang(pai.canMinggangOther(RelativeFangwei.DUIJIA, 32));
        pai.mo(41);
        pai.chu(41);
        pai.peng(pai.canPeng(RelativeFangwei.SHANGJIA, 29));
        pai.chu(21);
        pai.mo(29);
        pai.minggang(pai.canMinggangPeng()[0]);
        pai.mo(15);
        pai.angang(pai.canAngang()[0]);
        pai.mo(61);
        pai.buhua();
        pai.mo(39);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void LIAN_QI_DUI() {
        display(LIAN_QI_DUI);
        Pai pai = buildPai(
                38, 38, 32,
                32, 33, 33,
                35, 35, 34,
                34, 37, 37, 36,
                44, 44);
        pai.mo(36);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void SHI_SAN_YAO() {
        display(SHI_SAN_YAO);
        Pai pai = buildPai(
                11, 19, 21,
                29, 31, 39,
                41, 42, 43,
                44, 51, 52, 53,
                44, 44);
        pai.mo(41);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void QING_YAO_JIU() {
        display(QING_YAO_JIU);
        Pai pai = buildPai(
                11, 11, 11,
                29, 29, 29,
                31, 31, 31,
                39, 39, 39, 19,
                44, 44);
        pai.mo(19);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void XIAO_SI_XI() {
        display(XIAO_SI_XI);
        Pai pai = buildPai(
                41, 41, 41,
                42, 42, 42,
                43, 43, 43,
                44, 44, 11, 13,
                41, 43);
        pai.mo(12);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void XIAO_SAN_YUAN() {
        display(XIAO_SAN_YUAN);
        Pai pai = buildPai(
                51, 51, 51,
                52, 52, 52,
                53, 53, 13,
                14, 15, 19, 19,
                41, 43);
        pai.mo(19);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void ZI_YI_SE() {
        display(ZI_YI_SE);
        Pai pai = buildPai(
                41, 41, 41,
                42, 42, 42,
                43, 43, 43,
                51, 51, 53, 53,
                41, 43);
        pai.mo(53);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void SI_AN_KE() {
        display(SI_AN_KE);
        Pai pai = buildPai(
                11, 11, 11,
                22, 22, 22,
                33, 33, 33,
                51, 51, 53, 53,
                41, 43);
        pai.mo(53);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void YI_SE_SHUANG_LONG_HUI() {
        display(YI_SE_SHUANG_LONG_HUI);
        Pai pai = buildPai(
                11, 11, 12,
                12, 13, 13,
                15, 15, 17,
                18, 18, 19, 19,
                41, 43);
        pai.mo(17);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void YI_SE_SI_JIE_GAO() {
        display(YI_SE_SI_JIE_GAO);
        Pai pai = buildPai(
                11, 11, 11,
                12, 12, 12,
                13, 13, 13,
                14, 14, 14, 15,
                41, 43);
        pai.mo(15);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void YI_SE_SI_TONG_SHUN() {
        display(YI_SE_SI_TONG_SHUN);
        Pai pai = buildPai(
                11, 11, 11,
                11, 12, 12,
                12, 12, 13,
                13, 13, 18, 18,
                41, 43);
        pai.mo(13);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void YI_SE_SI_BU_GAO() {
        display(YI_SE_SI_BU_GAO);
        Pai pai = buildPai(
                11, 12, 13,
                13, 14, 15,
                15, 16, 17,
                17, 18, 22, 22,
                41, 43);
        pai.mo(19);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void SAN_GANG() {
        display(SAN_GANG);
        Pai pai = buildPai(
                31, 31, 31,
                32, 32, 32,
                15, 15, 15,
                29, 29, 21, 39,
                44, 44);
        pai.mo(31);
        pai.angang(pai.canAngang()[0]);
        pai.mo(41);
        pai.chu(41);
        pai.minggang(pai.canMinggangOther(RelativeFangwei.DUIJIA, 32));
        pai.mo(41);
        pai.chu(41);
        pai.peng(pai.canPeng(RelativeFangwei.SHANGJIA, 29));
        pai.chu(21);
        pai.mo(29);
        pai.minggang(pai.canMinggangPeng()[0]);
        pai.mo(39);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void HUN_YAO_JIU() {
        display(HUN_YAO_JIU);
        Pai pai = buildPai(
                11, 11, 11,
                21, 21, 21,
                39, 39, 41,
                41, 41, 52, 52,
                41, 43);
        pai.mo(52);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void QI_DUI() {
        display(QI_DUI);
        Pai pai = buildPai(
                12, 12, 14,
                14, 23, 23,
                33, 33, 34,
                34, 12, 21, 21,
                41, 43);
        pai.mo(12);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void QI_XING_BU_KAO() {
        display(QI_XING_BU_KAO);
        Pai pai = buildPai(
                12, 15, 18,
                21, 24, 33,
                51, 52, 53,
                41, 42, 43, 44,
                41, 43);
        pai.mo(39);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void QUAN_SHUANG_KE() {
        display(QUAN_SHUANG_KE);
        Pai pai = buildPai(
                12, 12, 12,
                24, 24, 24,
                28, 28, 32,
                32, 34, 34, 34,
                41, 43);
        pai.mo(32);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void QING_YI_SE() {
        display(QING_YI_SE);
        Pai pai = buildPai(
                11, 12, 13,
                12, 12, 12,
                15, 16, 17,
                17, 18, 19, 14,
                41, 43);
        pai.mo(17);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void YI_SE_SAN_JIE_GAO() {
        display(YI_SE_SAN_JIE_GAO);
        Pai pai = buildPai(
                11, 11, 11,
                12, 12, 12,
                13, 13, 13,
                27, 28, 29, 34,
                41, 43);
        pai.mo(34);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void YI_SE_SAN_TONG_SHUN() {
        display(YI_SE_SAN_TONG_SHUN);
        Pai pai = buildPai(
                11, 11, 11,
                12, 12, 12,
                13, 13, 34,
                27, 28, 29, 34,
                41, 43);
        pai.chi(pai.canChi(13)[0]);
        pai.chu(28);
        pai.mo(28);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void QUAN_DA() {
        display(QUAN_DA);
        Pai pai = buildPai(
                17, 18, 19,
                19, 19, 19,
                27, 28, 29,
                28, 28, 28, 37,
                41, 43);
        pai.mo(37);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void QUAN_ZHONG() {
        display(QUAN_ZHONG);
        Pai pai = buildPai(
                14, 15, 16,
                14, 15, 16,
                15, 15, 24,
                25, 26, 24, 24,
                41, 43);
        pai.mo(24);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void QUAN_XIAO() {
        display(QUAN_XIAO);
        Pai pai = buildPai(
                11, 11, 11,
                11, 12, 21,
                22, 23, 31,
                32, 33, 12, 12,
                41, 43);
        pai.mo(13);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void QING_LONG() {
        display(QING_LONG);
        Pai pai = buildPai(
                11, 12, 13,
                21, 22, 23,
                24, 25, 26,
                27, 28, 41, 41,
                41, 43);
        pai.mo(29);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void SAN_SE_SHUANG_LONG_HUI() {
        display(SAN_SE_SHUANG_LONG_HUI);
        Pai pai = buildPai(
                11, 12, 13,
                17, 18, 19,
                21, 22, 23,
                27, 28, 35, 35,
                41, 43);
        pai.mo(29);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void YI_SE_SAN_BU_GAO() {
        display(YI_SE_SAN_BU_GAO);
        Pai pai = buildPai(
                11, 12, 13,
                13, 14, 15,
                15, 16, 17,
                27, 28, 35, 35,
                41, 43);
        pai.mo(29);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void QUAN_DAI_WU() {
        display(QUAN_DAI_WU);
        Pai pai = buildPai(
                13, 14, 15,
                13, 14, 15,
                25, 26, 27,
                35, 35, 35, 25,
                41, 43);
        pai.mo(25);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void SAN_TONG_KE() {
        display(SAN_TONG_KE);
        Pai pai = buildPai(
                13, 13, 13,
                23, 23, 23,
                33, 33, 33,
                35, 36, 37, 52,
                41, 43);
        pai.mo(52);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void SAN_AN_KE() {
        display(SAN_AN_KE);
        Pai pai = buildPai(
                11, 11, 11,
                23, 23, 23,
                43, 43, 43,
                35, 36, 37, 52,
                41, 43);
        pai.mo(52);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void QUAN_BU_KAO() {
        display(QUAN_BU_KAO);
        Pai pai = buildPai(
                11, 14, 17,
                22, 25, 28,
                33, 39, 41,
                42, 43, 51, 52,
                41, 43);
        pai.mo(53);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void ZU_HE_LONG() {
        display(ZU_HE_LONG);
        Pai pai = buildPai(
                11, 14, 17,
                22, 25, 28,
                33, 36, 39,
                42, 43, 51, 52,
                41, 43);
        pai.mo(53);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void DA_YU_WU() {
        display(DA_YU_WU);
        Pai pai = buildPai(
                16, 17, 18,
                27, 28, 29,
                26, 26, 26,
                37, 37, 37, 18,
                41, 43);
        pai.mo(18);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void XIAO_YU_WU() {
        display(XIAO_YU_WU);
        Pai pai = buildPai(
                11, 12, 13,
                12, 13, 14,
                22, 23, 24,
                32, 33, 34, 31,
                41, 43);
        pai.mo(31);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void SAN_FENG_KE() {
        display(SAN_FENG_KE);
        Pai pai = buildPai(
                11, 12, 13,
                43, 43, 43,
                41, 41, 41,
                42, 42, 42, 31,
                41, 43);
        pai.mo(31);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void HUA_LONG() {
        display(HUA_LONG);
        Pai pai = buildPai(
                11, 12, 13,
                27, 28, 29,
                34, 35, 36,
                42, 42, 42, 31,
                41, 43);
        pai.mo(31);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void TUI_BU_DAO() {
        display(TUI_BU_DAO);
        Pai pai = buildPai(
                22, 22, 53,
                24, 25, 26,
                31, 32, 33,
                33, 34, 35, 53,
                41, 43);
        pai.mo(53);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void SAN_SE_SAN_JIE_GAO() {
        display(SAN_SE_SAN_JIE_GAO);
        Pai pai = buildPai(
                22, 22, 22,
                33, 33, 33,
                14, 14, 14,
                33, 34, 35, 53,
                41, 43);
        pai.mo(53);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void SAN_SE_SAN_TONG_SHUN() {
        display(SAN_SE_SAN_TONG_SHUN);
        Pai pai = buildPai(
                11, 12, 13,
                21, 22, 23,
                31, 32, 33,
                33, 34, 35, 36,
                41, 43);
        pai.mo(33);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void MIAO_SHOU_HUI_CHUN() {
        display(MIAO_SHOU_HUI_CHUN);
        Pai pai = buildPai(
                11, 12, 13,
                22, 23, 24,
                35, 36, 37,
                34, 34, 44, 44,
                41, 43);
        pai.mo(34);
        boolean canHu = pai.canHu(true, false, false, false, false);
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void HAI_DI_LAO_YUE() {
        display(HAI_DI_LAO_YUE);
        Pai pai = buildPai(
                11, 12, 13,
                22, 23, 24,
                35, 36, 37,
                34, 34, 44, 44,
                41, 43);
        boolean canHu = pai.canHu(RelativeFangwei.DUIJIA, 34, true, false, false, false, false);
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void GANG_SHANG_KAI_HUA() {
        display(GANG_SHANG_KAI_HUA);
        Pai pai = buildPai(
                11, 12, 13,
                22, 23, 24,
                35, 36, 37,
                34, 34, 34, 44,
                41, 43);
        pai.mo(34);
        pai.angang(pai.canAngang()[0]);
        pai.mo(44);
        boolean canHu = pai.canHu(false, false, false, true, false);
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void QIANG_GANG_HU() {
        display(QIANG_GANG_HU);
        Pai pai = buildPai(
                11, 12, 13,
                22, 23, 24,
                35, 36, 37,
                28, 29, 44, 44,
                41, 43);
        boolean canHu = pai.canHu(RelativeFangwei.XIAJIA, 27, false, false, true, false, false);
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void PENG_PENG_HU() {
        display(PENG_PENG_HU);
        Pai pai = buildPai(
                11, 11, 11,
                22, 22, 34,
                34, 44, 44,
                51, 51, 52, 52,
                41, 43);
        pai.peng(pai.canPeng(RelativeFangwei.DUIJIA, 51));
        pai.chu(34);
        pai.peng(pai.canPeng(RelativeFangwei.DUIJIA, 52));
        pai.chu(34);
        boolean canHu = pai.canHu(RelativeFangwei.XIAJIA, 22);
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void HUN_YI_SE() {
        display(HUN_YI_SE);
        Pai pai = buildPai(
                22, 22, 22,
                25, 26, 27,
                27, 28, 29,
                42, 42, 53, 53,
                41, 43);
        pai.mo(42);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void SAN_SE_SAN_BU_GAO() {
        display(SAN_SE_SAN_BU_GAO);
        Pai pai = buildPai(
                12, 13, 14,
                23, 24, 25,
                34, 35, 36,
                42, 42, 53, 53,
                41, 43);
        pai.mo(42);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void WU_MEN_QI() {
        display(WU_MEN_QI);
        Pai pai = buildPai(
                12, 13, 14,
                23, 24, 25,
                37, 37, 42,
                42, 42, 53, 53,
                41, 43);
        pai.mo(53);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void QUAN_QIU_REN() {
        display(QUAN_QIU_REN);
        Pai pai = buildPai(
                12, 13, 14,
                23, 24, 25,
                37, 37, 42,
                42, 42, 53, 53,
                41, 43);
        pai.mo(53);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void SHUANG_AN_GANG() {
        display(SHUANG_AN_GANG);
        Pai pai = buildPai(
                12, 12, 12,
                23, 23, 23,
                37, 38, 39,
                42, 42, 53, 53,
                41, 43);
        pai.mo(12);
        pai.angang(pai.canAngang()[0]);
        pai.mo(23);
        pai.angang(pai.canAngang()[0]);
        pai.mo(42);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void SHUANG_JIAN_KE() {
        display(SHUANG_JIAN_KE);
        Pai pai = buildPai(
                11, 12, 13,
                23, 23, 23,
                37, 37, 51,
                51, 51, 53, 53,
                41, 43);
        pai.mo(53);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void QUAN_DAI_YAO() {
        display(QUAN_DAI_YAO);
        Pai pai = buildPai(
                11, 12, 13,
                21, 22, 23,
                37, 38, 39,
                41, 41, 42, 42,
                41, 43);
        pai.mo(42);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void BU_QIU_REN() {
        display(BU_QIU_REN);
        Pai pai = buildPai(
                11, 12, 13,
                22, 23, 24,
                37, 38, 39,
                34, 34, 42, 42,
                41, 43);
        pai.mo(34);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void SHUANG_MING_GANG() {
        display(SHUANG_MING_GANG);
        Pai pai = buildPai(
                12, 12, 12,
                23, 23, 23,
                37, 38, 39,
                42, 42, 53, 53,
                41, 43);
        pai.minggang(pai.canMinggangOther(RelativeFangwei.DUIJIA, 12));
        pai.mo(23);
        pai.minggang(pai.canMinggangOther(RelativeFangwei.SHANGJIA, 23));
        pai.mo(42);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void HU_JUE_ZHANG() {
        display(HU_JUE_ZHANG);
        Pai pai = buildPai(
                11, 12, 13,
                22, 23, 24,
                37, 38, 39,
                34, 34, 42, 42,
                41, 43);
        pai.mo(34);
        boolean canHu = pai.canHu(false, true, false, false, false);
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void JIAN_KE() {
        display(JIAN_KE);
        Pai pai = buildPai(
                11, 12, 13,
                22, 23, 24,
                37, 38, 39,
                34, 34, 52, 52,
                41, 43);
        pai.mo(52);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void QUAN_FENG_KE() {
        display(QUAN_FENG_KE);
        Pai pai = buildPai(
                11, 12, 13,
                22, 23, 24,
                37, 38, 39,
                34, 34, 41, 41,
                41, 43);
        pai.mo(41);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void MEN_FENG_KE() {
        display(MEN_FENG_KE);
        Pai pai = buildPai(
                11, 12, 13,
                22, 23, 24,
                37, 38, 39,
                34, 34, 43, 43,
                41, 43);
        pai.mo(43);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void MEN_QIAN_QING() {
        display(MEN_QIAN_QING);
        Pai pai = buildPai(
                11, 12, 13,
                22, 23, 24,
                37, 38, 39,
                34, 34, 43, 43,
                41, 43);
        boolean canHu = pai.canHu(RelativeFangwei.XIAJIA, 34);
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void PING_HU() {
        display(PING_HU);
        Pai pai = buildPai(
                11, 12, 13,
                22, 23, 24,
                37, 38, 39,
                34, 35, 16, 16,
                41, 43);
        pai.mo(36);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void SI_GUI_YI() {
        display(SI_GUI_YI);
        Pai pai = buildPai(
                11, 12, 13,
                22, 23, 24,
                37, 38, 39,
                37, 37, 16, 16,
                41, 43);
        pai.mo(37);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void SHUANG_TONG_KE() {
        display(SHUANG_TONG_KE);
        Pai pai = buildPai(
                11, 11, 11,
                22, 23, 24,
                37, 38, 39,
                31, 31, 16, 16,
                41, 43);
        pai.mo(31);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void SHUANG_AN_KE() {
        display(SHUANG_AN_KE);
        Pai pai = buildPai(
                12, 12, 12,
                22, 23, 24,
                37, 38, 39,
                31, 31, 16, 16,
                41, 43);
        pai.mo(31);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void AN_GANG() {
        display(AN_GANG);
        Pai pai = buildPai(
                12, 12, 12,
                22, 23, 24,
                37, 38, 39,
                31, 32, 16, 16,
                41, 43);
        pai.mo(12);
        pai.angang(pai.canAngang()[0]);
        pai.mo(33);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void DUAN_YAO_JIU() {
        display(DUAN_YAO_JIU);
        Pai pai = buildPai(
                12, 12, 12,
                22, 23, 24,
                36, 37, 38,
                34, 35, 16, 16,
                41, 43);
        pai.mo(36);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void YI_BAN_GAO() {
        display(YI_BAN_GAO);
        Pai pai = buildPai(
                12, 12, 12,
                22, 23, 24,
                22, 23, 24,
                37, 38, 41, 41,
                41, 43);
        pai.mo(39);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void XI_XIANG_FENG() {
        display(XI_XIANG_FENG);
        Pai pai = buildPai(
                12, 12, 12,
                22, 23, 24,
                32, 33, 34,
                37, 38, 41, 41,
                41, 43);
        pai.mo(39);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void LIAN_LIU() {
        display(LIAN_LIU);
        Pai pai = buildPai(
                12, 12, 12,
                22, 23, 24,
                34, 35, 36,
                37, 38, 41, 41,
                41, 43);
        pai.mo(39);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void LAO_SHAO_FU() {
        display(LAO_SHAO_FU);
        Pai pai = buildPai(
                12, 12, 12,
                22, 23, 24,
                31, 32, 33,
                37, 38, 41, 41,
                41, 43);
        pai.mo(39);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void YAO_JIU_KE() {
        display(YAO_JIU_KE);
        Pai pai = buildPai(
                11, 11, 11,
                22, 23, 24,
                33, 34, 35,
                37, 38, 41, 41,
                41, 43);
        pai.mo(39);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void MING_GANG() {
        display(MING_GANG);
        Pai pai = buildPai(
                15, 15, 15,
                22, 23, 24,
                33, 34, 35,
                37, 38, 41, 41,
                41, 43);
        pai.minggang(pai.canMinggangOther(RelativeFangwei.XIAJIA, 15));
        pai.mo(39);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void QUE_YI_MEN() {
        display(QUE_YI_MEN);
        Pai pai = buildPai(
                25, 25, 25,
                22, 23, 24,
                33, 34, 35,
                37, 38, 41, 41,
                41, 43);
        pai.mo(39);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void WU_ZI() {
        display(WU_ZI);
        Pai pai = buildPai(
                15, 15, 15,
                22, 23, 24,
                33, 34, 35,
                37, 38, 11, 11,
                41, 43);
        pai.mo(39);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void BIAN_ZHANG() {
        display(BIAN_ZHANG);
        Pai pai = buildPai(
                15, 15, 15,
                22, 23, 24,
                33, 34, 35,
                38, 39, 41, 41,
                41, 43);
        pai.mo(37);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void KAN_ZHANG() {
        display(KAN_ZHANG);
        Pai pai = buildPai(
                15, 15, 15,
                22, 23, 24,
                33, 34, 35,
                37, 39, 38, 38,
                41, 43);
        pai.mo(38);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void DAN_DIAO_JIANG() {
        display(DAN_DIAO_JIANG);
        Pai pai = buildPai(
                15, 15, 15,
                22, 23, 24,
                33, 34, 35,
                37, 38, 39, 31,
                41, 43);
        pai.mo(31);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }

    @Test
    public void ZI_MO() {
        display(ZI_MO);
        Pai pai = buildPai(
                11, 12, 13,
                22, 23, 24,
                35, 36, 39,
                34, 34, 44, 44,
                41, 43);
        pai.peng(pai.canPeng(RelativeFangwei.DUIJIA, 34));
        pai.chu(39);
        pai.mo(37);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void WU_FAN_HU() {
        display(WU_FAN_HU);
        Pai pai = buildPai(
                11, 12, 13,
                22, 23, 24,
                35, 36, 39,
                34, 34, 44, 44,
                41, 43);
        pai.peng(pai.canPeng(RelativeFangwei.DUIJIA, 34));
        pai.chu(39);
        boolean canHu = pai.canHu(RelativeFangwei.XIAJIA, 37);
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    @Test
    public void HUA_PAI() {
        display(HUA_PAI);
        Pai pai = buildPai(
                11, 12, 13,
                22, 23, 24,
                35, 36, 39,
                34, 34, 44, 44,
                41, 43);
        pai.peng(pai.canPeng(RelativeFangwei.DUIJIA, 34));
        pai.chu(39);
        pai.mo(61);
        pai.buhua();
        pai.mo(62);
        pai.buhua();
        pai.mo(63);
        pai.buhua();
        pai.mo(37);
        boolean canHu = pai.canHu();
        assertEquals(true, canHu);
        pai.hu();
        display(pai);
    }
    
    private void display(Pai pai) {
        System.out.println("~~~~~~~~~~~~~~~~~~");
        System.out.println(pai);
    }
    
    private void display(GbPaixing paixing) {
        System.out.println(paixing.ordinal() + 1 + "、" + paixing);
    }
    
    private Pai buildPai(int p1, int p2, int p3, 
                         int p4, int p5, int p6, 
                         int p7, int p8, int p9,
                         int p10, int p11, int p12, int p13,
                         int quanfeng, int menfeng) {
        int[] init = new int[] { p1, p2, p3, 
                                 p4, p5, p6, 
                                 p7, p8, p9, 
                                 p10,p11,p12, 
                                 p13 };
        return new Pai(init, quanfeng, menfeng);
    }

}
